﻿<?xml version="1.0" encoding="utf-8"?>
<xsl:stylesheet version="2.0" 
                xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
                xmlns:xs="http://www.w3.org/2001/XMLSchema"
                xmlns:msxsl="urn:schemas-microsoft-com:xslt"
                xmlns:date="http://exslt.org/dates-and-times"
                extension-element-prefixes="date">
  <xsl:output method="html" indent="yes"/>

  <xsl:template match="Navigation">

  </xsl:template>
  <xsl:template match="Post">

    <xsl:if test="position()=1">

      <!-- BEGIN .main-post -->
      <div class='main-post'>
        <!-- BEGIN .post-image -->
        <div class='main-post-image'>
          <xsl:value-of select="MainImage" disable-output-escaping="yes" />
          <!-- END .post-image -->
        </div>
        <!-- BEGIN .post-content -->
        <div class='main-post-content'>
          <span class='main-post-date'>
            <xsl:value-of select="PublishedDate" />  |  <xsl:value-of select="Categories" disable-output-escaping="yes"/>  |  <xsl:value-of select="CommentCount"/> Comment(s)
          </span>
          <h3>
            <a>
              <xsl:attribute name="href">
                <xsl:value-of select="Link"/>
              </xsl:attribute>
              <xsl:value-of select="Title" />
            </a>
          </h3>
          <p>
            <xsl:value-of select="Excerpt" disable-output-escaping="yes"  />
          </p>
          <span class='main-post-link'>
            <a>
              <xsl:attribute name="href">
                <xsl:value-of select="Link"/>
              </xsl:attribute>
              READ MORE
            </a>
          </span>
          <!-- END .post-content -->
        </div>
        <!-- END .main-post -->
      </div>
    </xsl:if>
    <xsl:if test="position()>1">
    <xsl:variable name="Excerpt">
      <xsl:value-of select="Excerpt" disable-output-escaping="yes" />
    </xsl:variable>
    
    <!-- BEGIN .small-post -->
    <div class='small-post'>
      <!-- BEGIN .small-post-image -->
      <div class='small-post-image'>
        <xsl:value-of select="RollupImage" disable-output-escaping="yes" />
        <!-- END .small-post-image -->
      </div>
      <!-- BEGIN .small-post-content -->
      <div class='small-post-content'>
        <h3>
          <a>
            <xsl:attribute name="href">
              <xsl:value-of select="Link"/>
            </xsl:attribute>
            <xsl:value-of select="Title" />
          </a>
        </h3>
        <span class='small-post-date'>
          <xsl:value-of select="PublishedDate" />
          | <xsl:value-of select="Categories" disable-output-escaping="yes"/>  |  <xsl:value-of select="CommentCount"/> Comment(s)</span>
        <p>
          <xsl:value-of select="substring($Excerpt,1,150)"  disable-output-escaping="yes"/>
        </p>
        <span class='small-post-link'>
          <a>
            <xsl:attribute name="href">
              <xsl:value-of select="Link"/>
            </xsl:attribute>
            READ MORE</a>
        </span>
        <!-- END .small-post-content -->
      </div>
      <!-- END .post -->
    </div>

    </xsl:if>
  </xsl:template>
</xsl:stylesheet>
